<?php
namespace app\ausagent\controller;
use app\ausagent\controller\Common;
use think\Request;
use think\Db;
use think\Controller;
use think\Config;
use Godok\Org\Auth;
class Logs extends Common
{
	public function index(){

		$pages = 20;
		$where = '';
		$pageParam    = ['query' =>[]];
		$list = Db::name('logs')->where('oid',session('oid'))->order('create_time desc')->paginate($pages, false, $pageParam);
		$data = $list->all();
		$o ='operator';
		foreach ($data  as $k=>$v) {
				$data2 = Db::name('operator_users')
						   ->alias('a')
						   ->join("$o b",'a.oid = b.id')
						   ->where('a.id',$v['userid'])
						   ->field('a.username')
						   ->find();
		    $v['name'] = $data2['username'];
			$list[$k] = $v;	

		}

		//var_dump($list);die;
		$this->assign('list',$list);
		return $this->fetch();
	}
}